<%@ page contentType="text/html;charset=UTF-8"%> 
<%@ include file="/framework/purehead.jsp"%>
<LINK href="<%=Config.getWebPath()%>/css/css.css" rel="stylesheet" type="text/css">
<%
if(GSSystemConfigurator.getParam("gs.Version").equals("SH")){
%>
<SCRIPT language="javascript">
	<%=boxMsg(context)%>
</SCRIPT>

<script language=javascript>
function bizViewProduct(id)
{
    viewWin("<%=Config.getSrv()%>?action_code=viewProduct&Id="+id);
}

function doMoreExp(){
    SetAction("listWorldExp");
    frm.submit();
}

function doDisable(tableId,id,image){
	var rows =document.getElementById(tableId).rows;
	for(var i = 0 ; i< rows.length;i++){
		var rowId = rows[i].id;
		if(rowId != id && rowId.substring(0,6)==id){
			rows[i].style.display =="none"?image.src="<%=Config.getWebPath()%>/images/a3.png":image.src="<%=Config.getWebPath()%>/images/a2.png";
			rows[i].style.display = rows[i].style.display =="none"?"block":"none";
		}
	}
	
}
</script>

<%

String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

List outList = OutSub.getLast5OutSub(con, loginInfo);

String currentDate = (new DateUtil()).getFullString();
String year = currentDate.substring(0, 4);
String month = currentDate.substring(5, 7);
//List inOutCalList = InOutCal.calInOut(con, loginInfo, currentDate);
List inOutCalList = ViewInOutData.getInstance(con, loginInfo, currentDate).getList();
ObjectList warehouses = Warehouse.fetchWarehouses(con, loginInfo.getWarehouse().getCode());

String warehouseCode = loginInfo.getLoginWarehouseCode();
String warehouseJTCode = WorldExp.changeWarehouseJTCode(warehouseCode);

List worldExp = null;
if("00".equals(warehouseJTCode)){
    worldExp = WorldExpCalJT.calData(con, loginInfo);
}
else{
    worldExp = WorldExpCal.calData(con, loginInfo);
}
if(worldExp == null) worldExp = new ArrayList();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page import="java.util.List"%>
<%@page import="framework.core.DateUtil"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.hitrust.gs.lib.GSSystemConfigurator"%>
<%@page import="com.hitrust.gs.lib.GSBaseConstants"%>
<html>
  <head>
    <meta http-equiv="refresh" content="180">
    <base href="<%=basePath%>">
    
    <title></title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<LINK href="<%= Config.getWebPath() %>/system/css/caigouxitong.css" type=text/css rel=stylesheet>
	<LINK href="<%= Config.getWebPath() %>/system/css/css.css" type=text/css rel=stylesheet>
	<style type="text/css">
	<!--
		body {
			background-color: #FFFFFF;
			background-image: url(<%=Config.getWebPath()%>/images/2007-11-28_235006.gif);
			background-repeat: repeat-x;
		}
-->
</style>
<SCRIPT language=javascript src="<%=Config.getFrameworkPath()%>/js/func.js"></SCRIPT>
<SCRIPT language=javascript src="<%=Config.getFrameworkPath()%>/js/clock.js"></SCRIPT>
<SCRIPT language=javascript src="<%=Config.getFrameworkPath()%>/js/pub.js"></SCRIPT>
<SCRIPT language=javascript src="<%=Config.getWebPath()%>/system/js/biz.js"></SCRIPT>
  </head>
  
  <body>
   	<br>
<br>
<form id=frm action="<%=Config.getSrv()%>" method="post">
<input type=hidden name="action_code" value="">
<table width="750" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td valign="top" align="center"> 
	<!--左侧栏目-->
	<table width="370" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>
		
	<!-- 最新领用情况 -->
	<table width="750" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td colspan="3"><img src="<%=Config.getWebPath()%>/images/out.jpg" width="750" height="39" border="0" usemap="#Map" /></td>
        </tr>
      <tr>
        <td width="5%" height="5"></td>
        <td width="75%"></td>
        <td width="20%"></td>
      </tr>
<%
	for(int i = 0; i < outList.size(); i++){
		OutSub obj = (OutSub)outList.get(i);
        OutHead head = OutHead.fetch(con, obj.getOutBillId());
        if(head == null) head = OutHead.fetch();
        Product product = Product.fetch(con, obj.getProductId());
%>            
      <tr>
        <td><div align="center"><img src="<%=Config.getWebPath()%>/images/ball.jpg" width="7" height="8" /></div></td>
        <td><div align="left"><a href="" onclick="bizViewProduct('<%=product.getId()%>');return false;"><%= product.viewName(con) + "(" + product.viewConcentricityCode(con) + ")" %></a>
            &nbsp;&nbsp;<%= head.viewWarehouseName(con) + "(" + obj.viewGetCustomerName(con) + ")" %>
            &nbsp;&nbsp;领用<%= StringUtil.showCount(obj.viewProductCount(con)) %>(<%= product.viewProductUnit(con) %>)&nbsp;&nbsp;<%= StringUtil.showPrice(obj.getProductMoney(), 2) %>(元)
            </div>
        </td>
        <td><div align="left">&nbsp;<%= head.viewOutTime(con) %></div></td>
      </tr>
      <tr>
        <td height="5"></td>
        <td></td>
        <td></td>
      </tr>
<%
	}
%>      

           <tr>
                <td height="5"></td>
                <td></td>
                <td></td>
           </tr>
           <tr>
                 <td height="5"></td>
                 <td></td>
                 <td></td>
           </tr>   
     </table>
	 <!-- 最新领用情况 -->
		
		</td>
      </tr>
      <tr>
        <td height="10">
        
    <table  width="750" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="<%=Config.getWebPath()%>/images/ioavg.jpg" width="750" height="39" border="0" /></td>
      </tr>
      <tr>
                <td width="100%" height="5"></td>
      </tr>
      <tr>
          <table id="inOutTable" width="750" border="1" cellpadding="0" cellspacing="0">
            <tr>
                <td rowspan="2" width="16%" align="center">仓库</td>
                <td colspan="2" align="center"><%= year %>年</td>
                <td colspan="2" align="center"><%= month %>月</td>
                <td colspan="2" align="center">今日</td>
            </tr>
            <tr>
                <!-- <td width="16%"></td> -->
                <td width="14%" align="center">进(元)</td>
                <td width="14%" align="center">出(元)</td>
                <td width="14%" align="center">进(元)</td>
                <td width="14%" align="center">出(元)</td>
                <td width="14%" align="center">进(元)</td>
                <td width="14%" align="center">出(元)</td>
            </tr>
<%
    for(int i = 0; i < inOutCalList.size(); i++){
        InOutCal obj = (InOutCal)inOutCalList.get(i);
        String wcode = obj.getWarehouseCode();
        boolean showFlag = false;
        for(int kk = 0; kk < warehouses.size(); kk++){
           Warehouse wobj = (Warehouse)warehouses.get(kk);
           if(wcode.equalsIgnoreCase(wobj.getCode()) ){
               showFlag = true;
               break;
           }
        }
        if(showFlag){
            Warehouse warehouse = Warehouse.fetchByCode(con, obj.getWarehouseCode());
            if(warehouse == null) warehouse = Warehouse.fetch();
 
%>             
			<%
				if(wcode.length()<=6){
			 %>
			  <tr>
			  	<%if(wcode.length()>2){ %>
                <td align="left">&nbsp;<img src="<%=Config.getWebPath()%>/images/a2.png" onclick="doDisable('inOutTable','<%=wcode%>',this)">&nbsp;<%= warehouse.viewName(con) %></td>
                <%}else {%>
                <td align="left">&nbsp;<img src="<%=Config.getWebPath()%>/images/a4.png" >&nbsp;<%= warehouse.viewName(con) %></td>
                <%} %>
                <td align="right"><%= StringUtil.showPrice(obj.getYearIn() ,2) %></td>
                <td align="right"><%= StringUtil.showPrice(obj.getYearOut(), 2) %></td>
                <td align="right"><%= StringUtil.showPrice(obj.getMonthIn(),2) %></td>
                <td align="right"><%= StringUtil.showPrice(obj.getMonthOut(), 2) %></td>
                <td align="right"><%= StringUtil.showPrice(obj.getDayIn(),2) %></td>
                <td align="right"><%= StringUtil.showPrice(obj.getDayOut(), 2) %></td>
            </tr>
			 <%
			 	}else{
			 %>
           <tr 
           	<%if(wcode.length()==8 && loginInfo.getLoginWarehouseCode().length() == 8){ %>
           		style="display: block" 
           	<% }else{%> 
           		style="display: none" 
           	<% }%> 	
           	id = "<%=wcode%>">
                <td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%= warehouse.viewName(con) %></td>
                <td align="right"><%= StringUtil.showPrice(obj.getYearIn() ,2) %></td>
                <td align="right"><%= StringUtil.showPrice(obj.getYearOut(), 2) %></td>
                <td align="right"><%= StringUtil.showPrice(obj.getMonthIn(),2) %></td>
                <td align="right"><%= StringUtil.showPrice(obj.getMonthOut(), 2) %></td>
                <td align="right"><%= StringUtil.showPrice(obj.getDayIn(),2) %></td>
                <td align="right"><%= StringUtil.showPrice(obj.getDayOut(), 2) %></td>
            </tr>

<%
			}
        }
   }
%>                  
          </table>
      </tr>
      <tr>
                <td width="100%" height="5"></td>
      </tr>
      <tr>
                <td width="100%" height="5"></td>
      </tr>    
     </table>
    
        
        </td>
        
      </tr>
      
    <!-- 车辆整改数据 -->
    <tr>
        <td height="10">
        <dir style="display: none;">
    <table width="750" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td>
        <% 
        if(!GSBaseConstants.PLANPRICE.equals("true")){
        %>
            <a href="#" onclick = "doMoreExp();return false;"><img src="<%=Config.getWebPath()%>/images/exp.jpg" width="750" height="39" border="0" /></a>
        <%
        }
        %>
        </td>
      </tr>
      <tr>
                <td width="100%" height="5"></td>
      </tr>
      <tr>
<%
if(!GSBaseConstants.PLANPRICE.equals("true")){
if("00".equals(warehouseJTCode)){
%>          
          <table width="750" border="1" cellpadding="0" cellspacing="0">
              <tr>
                <td rowspan="3" width="16%" align="center">单位</td>
                <td colspan="4" align="center">发动机整治</td>
                <td colspan="4" align="center">外车身整治</td>
                <td colspan="4" align="center">内车身整治</td>
              </tr>
              <tr>
                <!-- <td width="16%"></td> -->
                <td width="14%" align="center" colspan="2"><%= month %>月</td>
                <td width="14%" align="center" colspan="2">累计</td>
                <td width="14%" align="center" colspan="2"><%= month %>月</td>
                <td width="14%" align="center" colspan="2">累计</td>
                <td width="14%" align="center" colspan="2"><%= month %>月</td>
                <td width="14%" align="center" colspan="2">累计</td>
              </tr>
              <tr>
                <!-- <td width="16%"></td> -->
                <td width="7%" align="center">整治数(台)</td>
                <td width="7%" align="center">材料整治费用(万元)</td>
                <td width="7%" align="center">整治数(台)</td>
                <td width="7%" align="center">材料整治费用(万元)</td>
                <td width="7%" align="center">整治数(台)</td>
                <td width="7%" align="center">材料整治费用(万元)</td>
                <td width="7%" align="center">整治数(台)</td>
                <td width="7%" align="center">材料整治费用(万元)</td>
                <td width="7%" align="center">整治数(台)</td>
                <td width="7%" align="center">材料整治费用(万元)</td>
                <td width="7%" align="center">整治数(台)</td>
                <td width="7%" align="center">材料整治费用(万元)</td>
              </tr>

<%
for(int i = 0; i < worldExp.size(); i++){
    WorldExpCalJT tj = (WorldExpCalJT)worldExp.get(i);
    String warehouseJTName = WorldExp.getWarehouseJTName(tj.getWarehouseCode());
%>
              <tr>  
                <td width="16%" align="center"><%= warehouseJTName %></td>
                <td width="7%" align="right"><%= tj.getFNum() %></td>
                <td width="7%" align="right"><%= StringUtil.showPrice(tj.getFPrice()/10000, 2) %></td>
                <td width="7%" align="right"><%= tj.getFLjNum() %></td>
                <td width="7%" align="right"><%= StringUtil.showPrice(tj.getFLjPrice()/10000,2) %></td>
                <td width="7%" align="right"><%= tj.getWNum() %></td>
                <td width="7%" align="right"><%= StringUtil.showPrice(tj.getWPrice()/10000,2) %></td>
                <td width="7%" align="right"><%= tj.getWLjNum() %></td>
                <td width="7%" align="right"><%= StringUtil.showPrice(tj.getWLjPrice()/10000,2) %></td>
                <td width="7%" align="right"><%= tj.getNNum() %></td>
                <td width="7%" align="right"><%= StringUtil.showPrice(tj.getNPrice()/10000,2) %></td>
                <td width="7%" align="right"><%= tj.getNLjNum() %></td>
                <td width="7%" align="right"><%= StringUtil.showPrice(tj.getNLjPrice()/10000,2) %></td>
              </tr>
<%
}
%>
              
          </table>
<%
}else{
%>

          <table width="750" border="1" cellpadding="0" cellspacing="0">
              <tr>
                <td rowspan="3" width="16%" align="center">车型</td>
                <td colspan="4" align="center">发动机整治</td>
                <td colspan="4" align="center">外车身整治</td>
                <td colspan="4" align="center">内车身整治</td>
              </tr>
              <tr>
                <!-- <td width="16%"></td> -->
                <td width="14%" align="center" colspan="2"><%= month %>月</td>
                <td width="14%" align="center" colspan="2">累计</td>
                <td width="14%" align="center" colspan="2"><%= month %>月</td>
                <td width="14%" align="center" colspan="2">累计</td>
                <td width="14%" align="center" colspan="2"><%= month %>月</td>
                <td width="14%" align="center" colspan="2">累计</td>
              </tr>
              <tr>
                <!-- <td width="16%"></td> -->
                <td width="7%" align="center">整治数(台)</td>
                <td width="7%" align="center">材料整治费用(万元)</td>
                <td width="7%" align="center">整治数(台)</td>
                <td width="7%" align="center">材料整治费用(万元)</td>
                <td width="7%" align="center">整治数(台)</td>
                <td width="7%" align="center">材料整治费用(万元)</td>
                <td width="7%" align="center">整治数(台)</td>
                <td width="7%" align="center">材料整治费用(万元)</td>
                <td width="7%" align="center">整治数(台)</td>
                <td width="7%" align="center">材料整治费用(万元)</td>
                <td width="7%" align="center">整治数(台)</td>
                <td width="7%" align="center">材料整治费用(万元)</td>
              </tr>

<%
for(int i = 0; i < worldExp.size(); i++){
    WorldExpCal tj = (WorldExpCal)worldExp.get(i);
%>
              <tr>  
                <td width="16%" align="center"><%= tj.getBusType() %></td>
                <td width="7%" align="right"><%= tj.getFNum() %></td>
                <td width="7%" align="right"><%= StringUtil.showPrice(tj.getFPrice()/10000, 2) %></td>
                <td width="7%" align="right"><%= tj.getFLjNum() %></td>
                <td width="7%" align="right"><%= StringUtil.showPrice(tj.getFLjPrice()/10000,2) %></td>
                <td width="7%" align="right"><%= tj.getWNum() %></td>
                <td width="7%" align="right"><%= StringUtil.showPrice(tj.getWPrice()/10000,2) %></td>
                <td width="7%" align="right"><%= tj.getWLjNum() %></td>
                <td width="7%" align="right"><%= StringUtil.showPrice(tj.getWLjPrice()/10000,2) %></td>
                <td width="7%" align="right"><%= tj.getNNum() %></td>
                <td width="7%" align="right"><%= StringUtil.showPrice(tj.getNPrice()/10000,2) %></td>
                <td width="7%" align="right"><%= tj.getNLjNum() %></td>
                <td width="7%" align="right"><%= StringUtil.showPrice(tj.getNLjPrice()/10000,2) %></td>
              </tr>
<%
}
%>
              
          </table>

<%
}}
%>          
 
   
        
        </td>
      </tr>
      

    </table>
	<!-- 车辆整改数据 -->
	</dir>
	</td>

  </tr>

</table>
</form>   	
  </body>
</html>
<%} %>
<%@ include file="/framework/purefoot.jsp"%>